import ecs_select
import pandas as pd

if __name__ == '__main__':
    all_ECS = ecs_select.ecs_execl('<accessid>','<accesskey>','cn-hongkong')
    xlsxName = '阿里云机器详情.xlsx'
    sheetName = 'depu'
    x = [[all_ECS[j][i] for j in range(len(all_ECS))] for i in range(len(all_ECS[0]))]
    data = { '产品名称': x[0], 'ip': x[1], 'cpu': x[2] ,'内存M': x[3],'系统': x[4],'到期时间': x[5]}
    df = pd.DataFrame.from_records(data,columns=['产品名称','ip','cpu','内存M','系统','到期时间'])
    df.to_excel(xlsxName, sheet_name=sheetName, index=True, header=True)